<!doctype html>
<html>
	<head>
		<title>Druid Spring Stat</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
		<link href='css/bootstrap.min.css' rel="stylesheet" />
		<link href="css/style.css" type="text/css" rel="stylesheet"/>
    	<script type="text/javascript" src="js/jquery.min.js"></script>
		<script src="js/common.js" type="text/javascript" charset="utf8"></script>
	</head>
	<body>
    	<div class="container-fluid">
      		<div class="row-fluid">
        		<div class="span12">
          				<h3>
          					Spring View
          					<a id="viewJsonApi" target="_blank">View JSON API</a>
          				</h3>
          				<table id="dataTable" class="table table-bordered" style="background-color: #fff">
							<tr>
					          	<td class='td_lable' width='130'> Class</td>
					          	<td id="Class"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> Method</td>
					          	<td id="Method"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> ExecuteCount</td>
					          	<td id="ExecuteCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> ExecuteErrorCount</td>
					          	<td id="ExecuteErrorCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> ExecuteTimeMillis</td>
					          	<td id="ExecuteTimeMillis"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> RunningCount</td>
					          	<td id="RunningCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> ConcurrentMax</td>
					          	<td id="ConcurrentMax"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcExecuteCount</td>
					          	<td id="JdbcExecuteCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcExecuteErrorCount</td>
					          	<td id="JdbcExecuteErrorCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcExecuteTimeMillis</td>
					          	<td id="JdbcExecuteTimeMillis"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcCommitCount</td>
					          	<td id="JdbcCommitCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcRollbackCount</td>
					          	<td id="JdbcRollbackCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcFetchRowCount</td>
					          	<td id="JdbcFetchRowCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcUpdateCount</td>
					          	<td id="JdbcUpdateCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcPoolConnectionOpenCount</td>
					          	<td id="JdbcPoolConnectionOpenCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcPoolConnectionCloseCount</td>
					          	<td id="JdbcPoolConnectionCloseCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcResultSetOpenCount</td>
					          	<td id="JdbcResultSetOpenCount"></td>
					        </tr>
					        <tr>
					          	<td class='td_lable'> JdbcResultSetCloseCount</td>
					          	<td id="JdbcResultSetCloseCount"></td>
					        </tr>
				      	</table>
				      	<div class="container">
				      		<a class="btn btn-primary" href="javascript:window.close();">Close</a>
				      	</div>
        		</div>
      		</div> 
    	</div>
    	<script type="text/javascript">
    	$.namespace("druid.springdetail");
    	druid.springdetail = function () {  
    		var clazz = druid.common.getUrlVar("class");
    		var method = druid.common.getUrlVar("method");
    		return  {
    			init : function() {
    				druid.common.buildHead(6);
    				this.ajaxRequestForBasicInfo();
    				$("#viewJsonApi").attr("href", 'spring-detail.json?class=' + clazz + '&method=' + method);
    			},
    			
    			ajaxRequestForBasicInfo : function() {
    				$.ajax({
    					type: 'POST',
    					url: 'spring-detail.json?class=' + clazz + '&method=' + method,
    					success: function(data) {
    						var stat = data.Content;
    						if (stat == null)
    							return;
    							
    						$("#Class").text(stat.Class)
    						$("#Method").text(stat.Method)
    						$("#ExecuteCount").text(stat.ExecuteCount)
    						$("#ExecuteErrorCount").text(stat.ExecuteErrorCount)
    						$("#ExecuteTimeMillis").text(stat.ExecuteTimeMillis)
    						$("#RunningCount").text(stat.RunningCount)
    						$("#ConcurrentMax").text(stat.ConcurrentMax)
    						$("#JdbcExecuteCount").text(stat.JdbcExecuteCount)
    						$("#JdbcExecuteErrorCount").text(stat.JdbcExecuteErrorCount)
    						$("#JdbcExecuteTimeMillis").text(stat.JdbcExecuteTimeMillis)
    						$("#JdbcCommitCount").text(stat.JdbcCommitCount)
    						$("#JdbcRollbackCount").text(stat.JdbcRollbackCount)
    						$("#JdbcFetchRowCount").text(stat.JdbcFetchRowCount)
    						$("#JdbcUpdateCount").text(stat.JdbcUpdateCount)
    						
    						$("#JdbcPoolConnectionOpenCount").text(stat.JdbcPoolConnectionOpenCount)
    						$("#JdbcPoolConnectionCloseCount").text(stat.JdbcPoolConnectionCloseCount)
    						$("#JdbcResultSetOpenCount").text(stat.JdbcResultSetOpenCount)
    						$("#JdbcResultSetCloseCount").text(stat.JdbcResultSetCloseCount)
    					},
    					dataType: "json"
    				});
    			}
    		}
    	}();

    	$(document).ready(function() {
    		druid.springdetail.init();
    	});
    	</script>
	</body>
</html>